package Smpales;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

/**
 *
 * @author Jakim
 */
public class MyWindow extends Frame {

    public Button btnTopOK;
    public Button btnLeftOk;
    public Button btnCenterOK;
    public Button btnCenterCancel;
    public Button btnRightOK;
    public Button btnBottomOK;
    public Panel panel1;
    public TextField txt1;

    public MyWindow(){
        super();

        this.btnTopOK = new Button("Top Ok");
        this.btnLeftOk = new Button("Left Ok");
        this.btnCenterOK = new Button("Center Ok");
        this.btnCenterCancel = new Button("Center Cancel");
        this.btnRightOK = new Button("Right Ok");
        this.btnBottomOK = new Button("Bottom Ok");
        this.panel1 = new Panel();
        this.txt1 = new TextField();
       
        this.panel1.setLayout(new FlowLayout());
        this.panel1.add(this.btnCenterOK);
        this.panel1.add(this.txt1);
        this.panel1.add(this.btnCenterCancel);
        this.txt1.setSize(120, 30);
        this.txt1.setText("" + this.txt1.getSize());
        this.btnTopOK.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
               SimpleWindow newWindow = new SimpleWindow();
               newWindow.setVisible(true);     
            }

        });
        this.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        this.add(this.btnTopOK, BorderLayout.NORTH);
        this.add(this.btnLeftOk, BorderLayout.WEST);
        this.add(this.panel1, BorderLayout.CENTER);
        this.add(this.btnRightOK, BorderLayout.EAST);
        this.add(this.btnBottomOK, BorderLayout.SOUTH);
        this.setSize(200, 300);
        this.setVisible(true);
    }

    public static void main(String[] args){
        MyWindow myWindow = new MyWindow();
    }
}
